﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web;

namespace DevFx.FrameWork.Context
{
    /// <summary>
    /// 框架上下文对象
    /// </summary>
    internal static class FrameContext
    {
        #region 私有成员

        /// <summary>
        /// 如果是winForm程序，该属性才会有值
        /// </summary>
        private static IDictionary dic;

        #endregion

        #region 公共方法

        /// <summary>
        /// 获取框架使用的上下文对象
        /// </summary>
        /// <returns></returns>
        public static IDictionary GetFrameContext()
        {
            //如果是Web程序则返回HttpContext中的字典项
            if (HttpContext.Current != null)
                return HttpContext.Current.Items;
            //如果不是则返回Win form的字典项
            if (dic == null)
                dic = new Hashtable();

            return dic;
        }

        #endregion


    }
}
